<template>
	<view class="content">
		<view class="content-box1">
			<view class="content-box1-con">
				<view class="box-item">
					<view class="box-item-l">
						投诉类型
					</view>
					<view class="box-item-r" hover-class="activeM" @click="openPicker">
						<uv-input v-model="typeName" disabled disabledColor='#fff' placeholder='请选择' border='none'
							suffixIcon='arrow-right' suffixIconStyle='color: #909399'></uv-input>
					</view>
				</view>

				<block v-if="current == 1">
					<view class="box-item">
						<view class="box-item-l">
							活动名称
						</view>
						<view class="box-item-r">
							<uv-input placeholder='请输入活动名称' border='none'></uv-input>
						</view>
					</view>

					<view class="box-item" style="border-bottom: none;margin-bottom: 0rpx;">
						<view class="box-item-l">
							投诉作品
						</view>
						<view class="box-item-r">
							<uv-input placeholder='请输入作品名称' border='none'></uv-input>
						</view>
					</view>
				</block>

				<block v-if="current == 2">
					<view class="box-item">
						<view class="box-item-l">
							作品名称
						</view>
						<view class="box-item-r">
							<uv-input placeholder='请输入作品名称' border='none'></uv-input>
						</view>
					</view>

					<view class="box-item" style="border-bottom: none;margin-bottom: 0rpx;">
						<view class="box-item-l">
							投诉作者
						</view>
						<view class="box-item-r">
							<uv-input placeholder='请输入作者名称' border='none'></uv-input>
						</view>
					</view>
				</block>

				<block v-if="current == 3">
					<view class="box-item">
						<view class="box-item-l">
							帖子标题
						</view>
						<view class="box-item-r">
							<uv-input placeholder='请输入标题名称' border='none'></uv-input>
						</view>
					</view>

					<view class="box-item" style="border-bottom: none;margin-bottom: 0rpx;">
						<view class="box-item-l">
							投诉用户
						</view>
						<view class="box-item-r">
							<uv-input placeholder='请输入投诉用户' border='none'></uv-input>
						</view>
					</view>
				</block>
			</view>
		</view>

		<view class="content-box1">
			<view class="content-box1-con">
				<view class="title">
					请选择投诉类型
				</view>

				<view class="box-item-b">
					<view :class="['box-item-b-item',item.id == reportCurrent ? 'active' : '']"
						v-for="(item,index) in list" :key="index" @click="chooseItem(item)">
						{{item.name}}
					</view>
				</view>
			</view>
		</view>

		<view class="content-box1">
			<view class="content-box1-con">
				<view class="title">
					请选择投诉类型
				</view>

				<view class="box-item-b1">
					<uv-textarea count border="none" v-model="textAreaValue" placeholder="请详细描述问题，以便我们尽快准确处理"
						height="100" maxlength="500" :customStyle="{ padding: '0rpx' }"></uv-textarea>
				</view>

				<view class="title" style="margin-top: 30rpx;">
					图片上传
				</view>

				<view class="title-text">
					请上传涉嫌违规的相关内容的图片证据或上传授权书（含授权人签字或盖章）等
				</view>

				<view class="content-box-con-item-t2">
					<view class="img" v-for="(item,index) in imageList" :key="index">
						<image :src="item" mode="widthFix" @click="prviewImage(index,imageList)">
						</image>
						<view class="delete" hover-class="activeM">
							<uv-icon name="close" color="#fff" size="12"></uv-icon>
						</view>
					</view>
					<view class="addphoto" hover-class="activeM">
						<image src="/static/images/tianjiazhaopian.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
		</view>

		<view class="content-box1">
			<view class="content-box1-con" style="padding: 30rpx 30rpx 0rpx 30rpx;">
				<view class="box-item">
					<view class="box-item-l">
						手机号码
					</view>
					<view class="box-item-r">
						<uv-input type="number" placeholder='请输入手机号码' border='none'></uv-input>
					</view>
				</view>
			</view>
		</view>

		<view style="width: 100%;height: 120rpx;"></view>

		<view class="bottom-box">
			<view class="bottom-box-l1" hover-class="activeM" @click="cancel">
				取消
			</view>
			<view class="bottom-box-r" hover-class="activeM">
				确认
			</view>
		</view>

		<uv-picker ref="picker" :columns="columns" @confirm="confirm" @change="changeWorkCate"></uv-picker>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	import {
		baseUrl,
		http
	} from '@/utils/request'
	import emitter from '@/utils/emitter.js'
	import {
		showMsg
	} from '@/utils/showMsg'

	const columns = ref([
		['活动', '作品', '社区']
	])

	const typeName = ref('活动')
	const current = ref(1)

	const list = ref([{
		id: 1,
		name: '涉嫌刷票'
	}, {
		id: 2,
		name: '侵犯权益'
	}, {
		id: 3,
		name: '搬运、 抄袭作品'
	}, {
		id: 4,
		name: '色情低俗'
	}, {
		id: 5,
		name: '违法犯罪'
	}, {
		id: 6,
		name: '政治敏感'
	}, {
		id: 7,
		name: '网络暴力'
	}])
	const picker = ref()

	const reportCurrent = ref(null)
	const textAreaValue = ref('')
	const imageList = ref(['https://picsum.photos/id/1011/600/800', 'https://picsum.photos/id/1012/600/800'])

	const prviewImage = (currentIndex, imageList) => {
		const urls = imageList.map(item => item)
		uni.previewImage({
			current: urls[currentIndex],
			urls: urls
		})
	}

	const openPicker = () => {
		picker.value.open()
	}
	
	const confirm = (e) => {
		console.log(e,'e');
		current.value = e.indexs[0] + 1
		typeName.value = columns.value[0][e.indexs[0]]
	}
	
	const chooseItem = (item) => {
		reportCurrent.value = item.id
	}
	
	const cancel = () => {
		uni.navigateBack()
	}
</script>

<style>
	page {
		background-color: #f2f3f7;
	}
</style>
<style lang="scss" scoped>
	.content-box1 {
		width: 100%;
		padding: 30rpx 30rpx 0rpx 30rpx;

		.content-box1-con {
			width: 100%;
			background: #FFFFFF;
			border-radius: 24rpx;
			padding: 30rpx;

			.title {
				width: 100%;
				font-weight: 400;
				font-size: 28rpx;
				color: #182033;
				margin-bottom: 20rpx;
			}

			.title-text {
				width: 100%;
				font-weight: 400;
				font-size: 24rpx;
				color: #9095A8;
			}

			.content-box-con-item-t2 {
				width: 100%;
				margin-top: 30rpx;
				display: flex;
				flex-wrap: wrap;
				gap: 30rpx;

				.img {
					position: relative;
					width: 140rpx;
					height: 140rpx;
					border-radius: 12rpx 12rpx 12rpx 12rpx;
					border: 2rpx solid #EDEFF6;

					image {
						width: 140rpx !important;
						height: 140rpx !important;
					}

					.delete {
						position: absolute;
						right: -8rpx;
						top: -12rpx;
						width: 36rpx;
						height: 36rpx;
						background: #B5BBCA;
						border-radius: 18rpx;
						display: flex;
						align-items: center;
						justify-content: center;
					}
				}



				.addphoto {
					width: 140rpx;
					height: 140rpx;

					image {
						width: 140rpx !important;
						height: 140rpx !important;
					}
				}
			}

			.box-item-b {
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				gap: 20rpx;

				.box-item-b-item {
					height: 60rpx;
					padding: 0rpx 20rpx;
					background: #F2F3F7;
					border: 2rpx solid #F2F3F7;
					font-weight: 400;
					font-size: 26rpx;
					color: #182033;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 6rpx;
				}

				.active {
					border: 2rpx solid #E90D00;
					color: #E90D00;
					background-color: #fff4f3;
				}
			}

			.box-item-b1 {
				width: 100%;

				::v-deep .uv-textarea.data-v-81cd9d32 {
					padding: 0rpx !important;
					padding-bottom: 50rpx !important;
				}
			}

			.box-item {
				width: 100%;
				display: flex;
				align-items: center;
				border-bottom: 2rpx solid #eee;
				padding-bottom: 30rpx;
				margin-bottom: 30rpx;

				.box-item-l {
					width: 30%;
					font-weight: 400;
					font-size: 28rpx;
					color: #182033;
				}

				.box-item-r {
					width: 70%;
				}
			}
		}
	}

	.bottom-box {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #fff;
		padding: 0rpx 30rpx;
		z-index: 99;

		.bottom-box-l,
		.bottom-box-r {
			width: 48%;
			height: 88rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			gap: 10rpx;
		}

		.bottom-box-l1 {
			width: 48%;
			height: 88rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			border: 2rpx solid #E90D00;
			border-radius: 44rpx;
			color: #E90D00;
			font-weight: 400;
			font-size: 30rpx;
		}

		.bottom-box-r {
			background-color: #e90d00;
			font-weight: 400;
			font-size: 30rpx;
			color: #FFFFFF;
			border-radius: 44rpx;
		}
	}
</style>